<?php
// +----------------------------------------------------------------------
// | quanli team
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2020 http://www.fistforward.com/ All rights reserved.
// +----------------------------------------------------------------------
// | Author: create by allen.qiang
// +----------------------------------------------------------------------


/**
 * 配送网点设置
 * @package  htdocs
 * @subpackage  quanliadmin
 * @author   create by allen.qiang
 */
require 'module/base/systemHandler.class.php';

class pa_branch {

    public function execute() {
        global $G_PGLOB ;
        if (isset($_REQUEST['operFlg'])) {

            switch($_REQUEST['operFlg']) {

                case 1: //配送网点信息列表
                    $this->branchList();
                    break;

                case 2: //添加配送网点
                    $this->branchAdd();
                    break;

                case 3: //编辑配送网点
                    $this->branchEdit();
                    break;

                default:
                    $G_PGLOB->smarty->assign('msg', '参数错误，请审核后再操作');
                    $G_PGLOB->smarty->display('comm/error.tpl');

            }
        }
    }

    //网店列表
	private function branchList(){
		global $G_PGLOB;  
		$G_PGLOB->smarty->display("system/branchList.tpl");
	}
	
	//网点增加
	private function branchAdd(){
		global $G_PGLOB;
		$G_PGLOB->smarty->display("system/branchAdd.tpl");
	}
	
	//网点修改
	private function branchEdit(){
		global $G_PGLOB;
		$branch_id = $_REQUEST['branch_id'];
		if($branch_id){
			$sql = "select * from sys_branch where branch_id = ?";
			$sql_params_type = "i";
			$sql_params_arr = array($branch_id);
			$result = $G_PGLOB->DBCA->stmt_query($sql,$sql_params_type,$sql_params_arr);
			error_log(print_r($result,true));
			$G_PGLOB->smarty->assign("result",$result);
			$G_PGLOB->smarty->display("system/branchAdd.tpl");
		}
	}
	
} 